/**
 * 
 */
package com.nwpusp.controller.actions;

import com.nwpusp.model.GameModel;
import com.nwpusp.model.StaticEntity;
import com.nwpusp.model.barrier.Barrier;
import com.nwpusp.model.characters.GameCharacter;
import com.nwpusp.model.players.Player;
import com.nwpusp.model.props.Prop;
import com.nwpusp.model.session.ConnectionId;

/**
 * @author JustinCao
 *
 */
public class BarrierCollideAction extends CollideAction {

	public BarrierCollideAction(ConnectionId cid, StaticEntity ent) {
		super(cid, ent);
	}

	@Override
	public void Invoke(GameModel m) {
		Barrier b = (Barrier)this.ent;
		if(m.getScenario().isExist(b)) {
			Player player = m.getPlayerManager().getPlayer(cid);
			if(player != null) {
				if(player.getCh().getStatus() != GameCharacter.CHARACTERSTS_Laydown) {
					b.Effect(player.getCh());
					m.getScenario().removeBarrier(ent.getStaticEntityId());
				}
			}
		}
	}

}
